package com.chat.biz.controller;

import com.chat.api.dto.AuthPullBlackDTO;
import com.chat.api.dto.AuthSetDTO;
import com.chat.api.entity.User;
import com.chat.biz.service.UserInfoService;
import com.chat.common.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 用户信息控制器
 *
 * @author chenhao
 * @date 2025/06/09
 *//*
*功能：
 作者：chenhao
*日期： 2025/6/7 下午4:39
*/
@RestController
@RequestMapping("/userinfo")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 个人信息详情
     *
     * @return {@link R }<{@link User }>
     */
    @GetMapping("details")
    public R<User> details(){
        User user = userInfoService.details();
        return R.ok(user);
    }

    /**
     * 设置个人信息
     *
     * @param dto 到
     * @return {@link R }<{@link Void }>
     */
    @PostMapping("setMyinformation")
    public R<Void> setMyinformation(@RequestBody AuthSetDTO dto){
        userInfoService.setMyinformation(dto);
        return R.ok();
    }


    /**
     * 他人详细信息
     *
     * @param userId 用户id
     * @return {@link R }<{@link User }>
     */
    @GetMapping("otherdetails")
    public R<User> otherdetails(@RequestParam("userId") String userId){
        User user = userInfoService.getotherdetails(userId);
        return R.ok(user);
    }

}
